﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using School.Entities;

namespace School.Common
{
    public static class GetClothesPaymentValue
    {
        public static SchoolEntities db = new SchoolEntities();
        public static decimal GetPaymentValue(int paymentOrderNum)
        {
            decimal totalValue = 0;
            var query = from payOrder in db.SRV_CLOTHES_PAYMENT_ORDER
                        where payOrder.Payment_Order_Number == paymentOrderNum
                        select payOrder;
            if (query.Count() > 0)
            {
                foreach (SRV_CLOTHES_PAYMENT_ORDER item in query)
                {
                    totalValue += item.Value;
                }
            }
            return totalValue;
        }
    }
}
